<%@ page language="java" import="java.util.*" pageEncoding="utf-8" contentType="text/html; charset=utf8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
    request.setCharacterEncoding("utf-8");
    response.setCharacterEncoding("utf-8");
	String htmlData =(request.getAttribute("content") != null ? (String) request.getAttribute("content") : "" );

%>

<!DOCTYPE HTML>
<html lang="zh-CN">
  <head>
    <base href="<%=basePath%>">
    
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    
    <title>kindEdit--（JSP导入）</title>
    
    <link rel="stylesheet" href="resources/js/kindeditor-4.1.10/themes/default/default.css" />
	<script charset="utf-8" src="resources/js/kindeditor-4.1.10/kindeditor-min.js"></script>
	<script charset="utf-8" src="resources/js/kindeditor-4.1.10/lang/zh_CN.js"></script>
	<script>
		var editor;
		KindEditor.ready(function(K) {
			editor = K.create('textarea[name="content"]', {
				uploadJson :      'resources/js/kindeditor-4.1.10/jsp/upload_json.jsp',
				resizeType : 1,
				allowPreviewEmoticons : false,
				allowImageUpload : true,
				
				items : [
					'undo', 'redo', '|','fontname', 'fontsize', 'forecolor', 'hilitecolor', 'bold', 'italic', 'underline',
					'removeformat', '|', 'justifyleft', 'justifycenter', 'justifyright', 'insertorderedlist',
					'insertunorderedlist',  'image']
			});
			
			
		});
	</script>
    
  </head>
  
  <body>
 
		<textarea name="content" style=""><%=htmlspecialchars( htmlData )%></textarea>  
 
 
  </body>
</html>
<!-- //取得HTML内容
	html = KE.html('editor_id');
	
	//同步数据后可以直接取得textarea的value
	KE.sync('editor_id');
	html = document.getElementById('editor_id').value;
	html = $('#editor_id').val(); //jQuery
	
	//设置HTML内容
	KE.html('editor_id', 'HTML内容');  
 -->
<%!
private String htmlspecialchars(String str) {
	str = str.replaceAll("&", "&amp;");
	str = str.replaceAll("<", "&lt;");
	str = str.replaceAll(">", "&gt;");
	str = str.replaceAll("\"", "&quot;");
	return str;
}
%>
